package com.shawn.springboot.integeration.validation.common.exception.base;

import lombok.Getter;

/**
 * @author shawn
 * @description: TODO
 * @date 2023/12/12
 */
@Getter
public class BaseException extends RuntimeException{
    private static final long serialVersionUID = 1L;

    /** 所属模块 **/
    private final String module;

    /** 错误码 **/
    private final String code;

    /** 错误码对应的参数 **/
    private final Object[] args;

    /** 错误消息 **/
    private final String defaultMessage;

    public BaseException(String module, String code, Object[] args, String defaultMessage)
    {
        this.module = module;
        this.code = code;
        this.args = args;
        this.defaultMessage = defaultMessage;
    }

    public BaseException(String module, String code, Object[] args)
    {
        this(module, code, args, null);
    }

    public BaseException(String module, String defaultMessage)
    {
        this(module, null, null, defaultMessage);
    }

    public BaseException(String code, Object[] args)
    {
        this(null, code, args, null);
    }

    public BaseException(String defaultMessage)
    {
        this(null, null, null, defaultMessage);
    }
}

